<?php

namespace app\store\validate;

use think\Validate;

class SpikeMeetingValidate extends Validate
{
    protected $rule = [
        'activity_time' => 'require|dateFormat:Y-m-d|unique:spike_meeting,activity_time^store_id',
        'desc' => 'max:255',
        'status' => 'require|in:0,1',
        'session_title' => 'require|array',
    ];


    protected $message = [
        'id.require' => '非法请求',
        'id.integer' => '非法请求',
        'activity_time.require' => '请选择活动时间!',
        'activity_time.dateFormat' => '不合法的时间格式!',
        'activity_time.unique' => '该活动已存在请勿重复添加!',
        'session_title.require' => '请选择场次!',
        'desc.max' => '轮播描述过长',
        'status.in' => '无效的状态值!',
    ];


    public function sceneSwitch()
    {
        return $this->only(['id','status'])
                    ->append('id', 'require|integer');
    }

    public function sceneEdit()
    {
    	return $this->only(['id','sort','activity_title','session_title','desc','status'])
                    ->append('id', 'require|integer');
            
    }   
}